unit udmin;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils,uDm,Windows;     //Windows这个linux下可能不行

function oracleconn(host,port,user,pass,db:string):Boolean;//LongBool; //cdecl  stdcall

function sqlconn(host,port,user,pass,db:string): Boolean;

function conexecute(avId: Integer): Boolean;

implementation



function oracleconn(host,port,user,pass,db:string):Boolean;
var
  tmpstr:string;
begin
 outputdebugstringw(pwidechar('getin oracleconnect;'));    //加入windows单元
 outputdebugstring(pchar(host));    //加入windows单元
 dm := TDm.create(nil);
 try
   try
   tmpstr := host + ':' + port + ':' + db;
   outputdebugstring(pansichar(tmpstr));
   dm.UniConora1.server:= tmpstr;
   dm.UniConora1.username:=user;

   dm.UniConora1.password:=pass;
   dm.UniConora1.Connected := True;
   dm.UniQuery5.SQL.Text := 'delete from yq_dp_faddress_ss_test';
   dm.UniQuery5.ExecSQL;
      outputdebugstring('oracleconnect result := true;');    //加入windows单元
   result := true;

   except
      on E: Exception do
        begin
          outputdebugstring('oracleconnect result := false;');
          result := false;
        end;
   end;

 finally
   freeandnil(dm);
 end;
end;


function sqlconn(host,port,user,pass,db:string):Boolean;
var
  tmpstr:string;
begin
 outputdebugstringw(pwidechar('getin sqlconnect;'));    //加入windows单元
 outputdebugstring(pchar(host));    //加入windows单元
 dm := TDm.create(nil);
 try
   try
   tmpstr := host + ':' + port + ':' + db;
   outputdebugstring(pansichar(tmpstr));
   dm.UniConsql1.server:= tmpstr;
   dm.UniConsql1.Database:= ;
   dm.UniConsql1.username:=user;

   dm.UniConsql1.password:=pass;
   dm.UniConsql1.Connected := True;
      outputdebugstring('sqlconn result := true;');    //加入windows单元
   result := true;

   except
      on E: Exception do
        begin
          outputdebugstring('sqlconn result := false;');
          result := false;
        end;
   end;
  finally
     freeandnil(dm);
  end;
end;

function conexecute(avId: Integer): Boolean;
begin
end;



end.

